package lab.jsp;

import java.io.IOException;
import java.sql.SQLException;
import java.util.Collection;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import lab.domain.Genre;
import lab.jsp.util.DatabaseHelper;

/**
 *
 * @author Smike
 */
public class Genres extends AbstractJSP<Collection<Genre>> {

    @Override
    public void _jspService(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // do nothing, it's will be implemented by JSP
    }

    @Override
    protected Collection<Genre> getData() {
        try {
            return DatabaseHelper.findGenres(getConnection());
        } catch (SQLException ex) {
            Logger.getLogger(Genres.class.getName()).log(Level.SEVERE, null, ex);
            throw new RuntimeException(ex);
        }
    }

}
